import { View, Image } from "@tarojs/components";
import { AtIcon } from "taro-ui";
import PropTypes from 'prop-types';
import styles from './index.less';
import { pngMap } from "../../static/property";



const ActionItem = (props) => {

  const { text, iconName, onClick } = props;

  return (
    <View className={styles.item} onClick={onClick}>
      <View className={styles.item__text}>
        <Image className={styles.img} src={pngMap[iconName]} />
        {text}
      </View>
      <View className={styles.item__icon}>
        <AtIcon value='chevron-right' size='24' />
      </View>
    </View>
  )
}

ActionItem.propTypes = {
  text: PropTypes.string.isRequired,
  iconName: PropTypes.string,
  onClick: PropTypes.func,
}

export default ActionItem;